\hypertarget{class_sound_engine_pulse_audio}{
\section{SoundEnginePulseAudio Class Reference}
\label{class_sound_engine_pulse_audio}\index{SoundEnginePulseAudio@{SoundEnginePulseAudio}}
}


Pulse Audio sound server client to play sound effects.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_sound_engine_pulse_audio_a0a6972f6f99723d4d38d58a37117f26b}{
void \hyperlink{class_sound_engine_pulse_audio_a0a6972f6f99723d4d38d58a37117f26b}{setVolumeLevel} (int volumeLevel)}
\label{class_sound_engine_pulse_audio_a0a6972f6f99723d4d38d58a37117f26b}

\begin{DoxyCompactList}\small\item\em Sets the volume level. \item\end{DoxyCompactList}\item 
void \hyperlink{class_sound_engine_pulse_audio_acb1086270f3272dbfd9419dc866ef22b}{play} (\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType})
\begin{DoxyCompactList}\small\item\em Plays the sound affect given at the parameter {\itshape soundEffect\/}. \item\end{DoxyCompactList}\item 
void \hyperlink{class_sound_engine_pulse_audio_a2a6e39267b5ca1d0c32cc2d0c429f10e}{addEffectBuffer} (\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType} effectType, QByteArray $\ast$buffer)
\begin{DoxyCompactList}\small\item\em Adds sound data buffer for the sound effect. \item\end{DoxyCompactList}\item 
void \hyperlink{class_sound_engine_pulse_audio_ad906700c5b2e7232a79a325165b902b5}{setAudioFormat} (const QAudioFormat \&)
\begin{DoxyCompactList}\small\item\em Sets the audio format used at playback. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_a1a7f3ae3d1911feb8aa4416d6f8d7d1e}{
pa\_\-context $\ast$ \hyperlink{class_sound_engine_pulse_audio_a1a7f3ae3d1911feb8aa4416d6f8d7d1e}{context} ()}
\label{class_sound_engine_pulse_audio_a1a7f3ae3d1911feb8aa4416d6f8d7d1e}

\begin{DoxyCompactList}\small\item\em Getter for Pulse Audio mainloop. \item\end{DoxyCompactList}\item 
pa\_\-sample\_\-spec \hyperlink{class_sound_engine_pulse_audio_a1b89f7bad63032bab7935b3fff01f201}{audioFormatToSampleSpec} (const QAudioFormat \&format)
\begin{DoxyCompactList}\small\item\em Getter for Pulse Audio context. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_a1cf8f903dfe7a2d721dab43d073e7348}{
QAudioFormat \hyperlink{class_sound_engine_pulse_audio_a1cf8f903dfe7a2d721dab43d073e7348}{sampleSpecToAudioFormat} (pa\_\-sample\_\-spec spec)}
\label{class_sound_engine_pulse_audio_a1cf8f903dfe7a2d721dab43d073e7348}

\begin{DoxyCompactList}\small\item\em Converts pa\_\-sample\_\-spec to QAudioFormat. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_sound_engine_pulse_audio_af030b6809c29cffd35420b59b194d89a}{
static \hyperlink{class_sound_engine_pulse_audio}{SoundEnginePulseAudio} $\ast$ \hyperlink{class_sound_engine_pulse_audio_af030b6809c29cffd35420b59b194d89a}{instance} ()}
\label{class_sound_engine_pulse_audio_af030b6809c29cffd35420b59b194d89a}

\begin{DoxyCompactList}\small\item\em Gets the instance from Pulse Audio sound server client. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_sound_engine_pulse_audio_a8da7f370b57631cbfa489e6979ac72cf}{
QList$<$ QByteArray $>$ \hyperlink{class_sound_engine_pulse_audio_a8da7f370b57631cbfa489e6979ac72cf}{pulseSinks}}
\label{class_sound_engine_pulse_audio_a8da7f370b57631cbfa489e6979ac72cf}

\begin{DoxyCompactList}\small\item\em Pulse Audio sinks. Used from callback methods. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_af2b901979257bb351d882f0b976350aa}{
QMap$<$ QByteArray, QAudioFormat $>$ \hyperlink{class_sound_engine_pulse_audio_af2b901979257bb351d882f0b976350aa}{preferredFormats}}
\label{class_sound_engine_pulse_audio_af2b901979257bb351d882f0b976350aa}

\begin{DoxyCompactList}\small\item\em Preferred audio formats. Used from callback methods. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_a0c7e2907b1894e131e2c49f80a221137}{
QByteArray \hyperlink{class_sound_engine_pulse_audio_a0c7e2907b1894e131e2c49f80a221137}{defaultSink}}
\label{class_sound_engine_pulse_audio_a0c7e2907b1894e131e2c49f80a221137}

\begin{DoxyCompactList}\small\item\em Pulse Audio default sink. Used from callback methods. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_sound_engine_pulse_audio_a09854a07a24ea57ec3d0b81842172d85}{
void \hyperlink{class_sound_engine_pulse_audio_a09854a07a24ea57ec3d0b81842172d85}{serverInfo} ()}
\label{class_sound_engine_pulse_audio_a09854a07a24ea57ec3d0b81842172d85}

\begin{DoxyCompactList}\small\item\em Gets the server info form Pulse Audio server via serverInfoCallback(). \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_ade631879b560442081a924a32ca9073d}{
void \hyperlink{class_sound_engine_pulse_audio_ade631879b560442081a924a32ca9073d}{sinks} ()}
\label{class_sound_engine_pulse_audio_ade631879b560442081a924a32ca9073d}

\begin{DoxyCompactList}\small\item\em Gets the sinks info form Pulse Audio server via sinkInfoCallback(). \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_sound_engine_pulse_audio_a26cf2eb03318428488910bc0445ae083}{
pa\_\-mainloop\_\-api $\ast$ \hyperlink{class_sound_engine_pulse_audio_a26cf2eb03318428488910bc0445ae083}{pulseMainLoopApi}}
\label{class_sound_engine_pulse_audio_a26cf2eb03318428488910bc0445ae083}

\begin{DoxyCompactList}\small\item\em Pulse Audio mainloop API. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_a8a9629a8b1875f60e1fcf56332f996cf}{
pa\_\-threaded\_\-mainloop $\ast$ \hyperlink{class_sound_engine_pulse_audio_a8a9629a8b1875f60e1fcf56332f996cf}{pulseMainLoop}}
\label{class_sound_engine_pulse_audio_a8a9629a8b1875f60e1fcf56332f996cf}

\begin{DoxyCompactList}\small\item\em Pulse Audio mainloop. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_a4b375f3d4f231d294343fdf2695ffc00}{
pa\_\-context $\ast$ \hyperlink{class_sound_engine_pulse_audio_a4b375f3d4f231d294343fdf2695ffc00}{pulseContext}}
\label{class_sound_engine_pulse_audio_a4b375f3d4f231d294343fdf2695ffc00}

\begin{DoxyCompactList}\small\item\em Pulse Audio context. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_aefcbdf310a6852eac603e0e735713ccd}{
\hyperlink{class_pulse_audio_output}{PulseAudioOutput} $\ast$ \hyperlink{class_sound_engine_pulse_audio_aefcbdf310a6852eac603e0e735713ccd}{pulseAudioOutput}}
\label{class_sound_engine_pulse_audio_aefcbdf310a6852eac603e0e735713ccd}

\begin{DoxyCompactList}\small\item\em Pulse Audio output. \item\end{DoxyCompactList}\item 
\hypertarget{class_sound_engine_pulse_audio_a0b43a73380783fb9f1400eed8b6bcd72}{
QAudioFormat \hyperlink{class_sound_engine_pulse_audio_a0b43a73380783fb9f1400eed8b6bcd72}{audioFormat}}
\label{class_sound_engine_pulse_audio_a0b43a73380783fb9f1400eed8b6bcd72}

\begin{DoxyCompactList}\small\item\em Audio format to be used at output. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_sound_engine_pulse_audio_a67882088552c884bacbbb5ed45780fbc}{
static \hyperlink{class_sound_engine_pulse_audio}{SoundEnginePulseAudio} $\ast$ \hyperlink{class_sound_engine_pulse_audio_a67882088552c884bacbbb5ed45780fbc}{soundEngine} = NULL}
\label{class_sound_engine_pulse_audio_a67882088552c884bacbbb5ed45780fbc}

\begin{DoxyCompactList}\small\item\em Pulse Audio sound engine instance. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Pulse Audio sound server client to play sound effects. Sound server client is using Pulse Audio Asynchronous C API. Creates also Pulse Audio output device for sound effect playback.

Singleton design pattern is used when implementing \hyperlink{class_sound_engine_pulse_audio}{SoundEnginePulseAudio} to ensure that only one instance exists.

Pulse Audio sound server is preferred way to play game sound effects because of low latency.

\begin{DoxySeeAlso}{See also}
\hyperlink{class_sound_engine}{SoundEngine} \hyperlink{class_pulse_audio_output}{PulseAudioOutput} 
\end{DoxySeeAlso}


\subsection{Member Function Documentation}
\hypertarget{class_sound_engine_pulse_audio_a2a6e39267b5ca1d0c32cc2d0c429f10e}{
\index{SoundEnginePulseAudio@{SoundEnginePulseAudio}!addEffectBuffer@{addEffectBuffer}}
\index{addEffectBuffer@{addEffectBuffer}!SoundEnginePulseAudio@{SoundEnginePulseAudio}}
\subsubsection[{addEffectBuffer}]{\setlength{\rightskip}{0pt plus 5cm}void SoundEnginePulseAudio::addEffectBuffer (
\begin{DoxyParamCaption}
\item[{{\bf SoundEffectType}}]{ effectType, }
\item[{QByteArray $\ast$}]{ buffer}
\end{DoxyParamCaption}
)}}
\label{class_sound_engine_pulse_audio_a2a6e39267b5ca1d0c32cc2d0c429f10e}


Adds sound data buffer for the sound effect. 

Type of sound effect is given at the {\itshape effectType\/} parameter. Sound data is given at the {\itshape buffer\/} parameter. \begin{DoxySeeAlso}{See also}
\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType}. 
\end{DoxySeeAlso}
\hypertarget{class_sound_engine_pulse_audio_a1b89f7bad63032bab7935b3fff01f201}{
\index{SoundEnginePulseAudio@{SoundEnginePulseAudio}!audioFormatToSampleSpec@{audioFormatToSampleSpec}}
\index{audioFormatToSampleSpec@{audioFormatToSampleSpec}!SoundEnginePulseAudio@{SoundEnginePulseAudio}}
\subsubsection[{audioFormatToSampleSpec}]{\setlength{\rightskip}{0pt plus 5cm}pa\_\-sample\_\-spec SoundEnginePulseAudio::audioFormatToSampleSpec (
\begin{DoxyParamCaption}
\item[{const QAudioFormat \&}]{ format}
\end{DoxyParamCaption}
)}}
\label{class_sound_engine_pulse_audio_a1b89f7bad63032bab7935b3fff01f201}


Getter for Pulse Audio context. 

Converts the QAudioFormat to pa\_\-sample\_\-spec. \hypertarget{class_sound_engine_pulse_audio_acb1086270f3272dbfd9419dc866ef22b}{
\index{SoundEnginePulseAudio@{SoundEnginePulseAudio}!play@{play}}
\index{play@{play}!SoundEnginePulseAudio@{SoundEnginePulseAudio}}
\subsubsection[{play}]{\setlength{\rightskip}{0pt plus 5cm}void SoundEnginePulseAudio::play (
\begin{DoxyParamCaption}
\item[{{\bf SoundEffectType}}]{ soundEffect}
\end{DoxyParamCaption}
)}}
\label{class_sound_engine_pulse_audio_acb1086270f3272dbfd9419dc866ef22b}


Plays the sound affect given at the parameter {\itshape soundEffect\/}. 

\begin{DoxySeeAlso}{See also}
\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType}. 
\end{DoxySeeAlso}
\hypertarget{class_sound_engine_pulse_audio_ad906700c5b2e7232a79a325165b902b5}{
\index{SoundEnginePulseAudio@{SoundEnginePulseAudio}!setAudioFormat@{setAudioFormat}}
\index{setAudioFormat@{setAudioFormat}!SoundEnginePulseAudio@{SoundEnginePulseAudio}}
\subsubsection[{setAudioFormat}]{\setlength{\rightskip}{0pt plus 5cm}void SoundEnginePulseAudio::setAudioFormat (
\begin{DoxyParamCaption}
\item[{const QAudioFormat \&}]{ format}
\end{DoxyParamCaption}
)}}
\label{class_sound_engine_pulse_audio_ad906700c5b2e7232a79a325165b902b5}


Sets the audio format used at playback. 

Format is given at the parameter {\itshape format\/}. 

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
soundenginepulseaudio.h\item 
soundenginepulseaudio.cpp\end{DoxyCompactItemize}
